package cn.agiledata.bank.linkbank.impl.cmbc;

import cn.agiledata.bank.linkbank.logic.OrderIdTransformer;

/**
 * 中国民生银行订单编号转换器。提供支付系统交易编号与向民生银行提交的订单编号的转换逻辑
 * 
 * @author jessik
 * 
 */
public final class CmbcOrderIdTransformer implements OrderIdTransformer {

	private String corpID;
	
	public CmbcOrderIdTransformer() {
		super();
	}
	
	public CmbcOrderIdTransformer(String corpID) {
		super();
		this.corpID = corpID;
	}

	public String orderId2TransId(String orderId) {
		if (orderId == null)
			return null;
		return orderId.substring(5, 20);
	}

	public String transId2OrderId(String transId) {
		if (transId == null)
			return null;
		return this.corpID + transId;
	}

}
